import React, {useEffect, useState, useRef} from 'react'
import {
	Button,
	Space,
	message,
	Tag,
	Modal,
	Form,
	Row,
	Col,
	Input,
	Radio,
	Popconfirm,
} from 'antd'
import {
	PlusOutlined,
	ArrowDownOutlined,
	ArrowUpOutlined,
	PlusCircleOutlined,
} from '@ant-design/icons'

import {history, connect, useDispatch} from 'umi'

import styles from './index.less'
import SearchForm from '@/components/SearchForm'
import CustomTable from '@/components/Table'
import Permissions from '@/components/Permissions'
import DriverRelationList from './components/DriverRelationList'
import ChannelRelationList from './components/ChannelRelationList'

import {
	commodityList,
	getOrderType,
	getApprovalStatus,
	getSchemeStatus,
	requisitionImport,
	getCommodityimporterror,
	batchApproval,
	updateDisableStatus,
	remove,
} from '@/service/marketing/commodity'

import {modelSeriesFun, translateDataToTree} from '@/utils/common/index'
import 'moment/locale/zh-cn'
import BatchUpload from './components/BatchUpload'
import {getMainCompanyList, getCompany} from '@/service/system/company'
import {modalApi} from '@/utils/modalReq'
import {formatDate} from '@/utils/common/dateFilter'
import {downloadDocumentUrl} from '@/service/common/download'
import {getCarTypeList} from '@/service/carMessage/list'
import {getAllCitys, processRecordSave} from '@/service/common'
import {disableStatusList} from '../dict'

const formItemLayout = {
	labelCol: {flex: '110px'},
	wrapperCol: {flex: '1'},
}
const {TextArea} = Input
const commodityPlan = (props: {user: any}) => {
	const dispatch = useDispatch()
	const {orgId, userId} = props.user
	const [params, setParams] = useState({
		current: 1,
		size: 10,
	})
	const [total, setTotal] = useState(0)
	const [loading, setLoading] = useState(false)

	const [citysList, setCitysList] = useState([])
	const [orderType, setOrderType] = useState([])
	const [approvalStatus, setApprovalStatus] = useState([])
	const [schemeStatus, setSchemeStatus] = useState([])
	const [checkData, setCheckData] = useState<any>([])
	const [mainCompany, setMainCompanyList] = useState([])
	const [orgSource, setOrgSource] = useState<any>([])

	const [dataSourse, setDataSourse] = useState([])
	const [searchData, setSearchData] = useState({})
	const [formData, setFormData] = useState<any[]>([])
	const [isUploadModalOpen, setIsUploadModalOpen] = useState(false)
	const [carTypeList, setCarTypeList] = useState<any>([])
	const [selectRow, setSelectRow] = useState<any>({})
	const [isDriverOpen, setIsDriverOpen] = useState(false)
	const [isChannelOpen, setIsChannelOpen] = useState(false)

	// 审核弹窗
	const [isToExamineView, setIsToExamineView] = useState(false)
	const [toExamineForm] = Form.useForm()

	// 获取主体数据
	const onMainCompanyeListFun = () => {
		getMainCompanyList().then((res: any) => {
			if (res?.success) {
				setMainCompanyList(res.data)
			}
		})
	}

	// 获取品牌车系
	const onCarTypeListFun = () => {
		getCarTypeList().then((res: any) => {
			if (res?.success) {
				setCarTypeList(modelSeriesFun(res.data))
			}
		})
	}

	// 获取组织机构数据
	const onOrgFun = () => {
		getCompany({merchantId: orgId}).then((res: any) => {
			if (res?.success) {
				const list: any = translateDataToTree(res?.data)
				setOrgSource(list as any)
			}
		})
	}
	useEffect(() => {
		onOrgFun()
	}, [orgId])

	/** 获取城市列表 */
	const getCitysFun = () => {
		getAllCitys().then((res: any) => {
			if (res?.success) {
				setCitysList(() => res?.data)
			}
		})
	}

	/** 获取订单类型列表 */
	const getOrderTypeFun = () => {
		getOrderType().then((res: any) => {
			if (res?.success) {
				setOrderType(() => res?.data)
			}
		})
	}

	/** 获取审核状态列表 */
	const getApprovalStatusFun = () => {
		getApprovalStatus().then((res: any) => {
			if (res?.success) {
				setApprovalStatus(() => res?.data)
			}
		})
	}

	/** 获取审核状态列表 */
	const getSchemeStatusFun = () => {
		getSchemeStatus().then((res: any) => {
			if (res?.success) {
				setSchemeStatus(() => res?.data)
			}
		})
	}

	useEffect(() => {
		getCitysFun()
		getOrderTypeFun()
		onCarTypeListFun()
		getSchemeStatusFun()
		getApprovalStatusFun()
		onMainCompanyeListFun()
	}, [])

	// 获取表格数据
	const onListFun = () => {
		setLoading(true)
		commodityList({
			query: {...params, descs: 'update_time'},
			commoditySchemeVO: {...searchData},
		})
			.then((res: any) => {
				if (res?.success) {
					setDataSourse(() => res?.data?.records)
					setTotal(() => res?.data?.total)
				}
				setLoading(false)
			})
			.catch(() => {
				setLoading(false)
			})
	}

	// 获取表格数据
	const onRemoveFun = (id?: any) => {
		const idsList = checkData
			?.filter(
				(item: any) =>
					item?.auditStatusId === '0' || item?.auditStatusId === '2',
			)
			.map((item: any) => item.id)
		const ids = id ? [id] : idsList?.join(',')
		remove({ids})
			.then((res: any) => {
				if (res?.success) {
					message.success(res.msg)
					if (dataSourse.length === 1) {
						const param = {
							...params,
							current: 1,
						}
						setParams(param)
					} else {
						onListFun()
					}
				}
			})
			.catch((err) => {
				message.error(err)
			})
	}

	// 获取表格数据
	// 自定义一个初始不更新的hook
	const useUpdateEffect = (fn: Function, inputs: any[]) => {
		const didMountRef = useRef(false)
		useEffect(() => {
			if (didMountRef.current) fn()
			else didMountRef.current = true
		}, inputs)
	}

	// 使用自定义hook
	useUpdateEffect(onListFun, [params])

	// 错误数据列表
	const errorColumns: any = [
		{
			title: '商品方案',
			children: [
				// 商品信息
				{
					title: '方案名称',
					dataIndex: 'commodityName',
					align: 'center',
					ellipsis: true,
					width: 120,
					render: (text: string, records: any) => (
						<span>
							{records.commoditySchemeExcelImportErrorVO
								.commodityName || '--'}
						</span>
					),
				},
				{
					title: '方案生效时间',
					dataIndex: 'beginTime',
					align: 'center',
					ellipsis: true,
					width: 150,
					render: (text: string, records: any) => (
						<span>
							{records.commoditySchemeExcelImportErrorVO
								.beginTime || '--'}
						</span>
					),
				},
				{
					title: '方案失效时间',
					dataIndex: 'endTime',
					align: 'center',
					ellipsis: true,
					width: 120,
					render: (text: string, records: any) => (
						<span>
							{records.commoditySchemeExcelImportErrorVO
								.endTime || '--'}
						</span>
					),
				},
				{
					title: '主体名称',
					dataIndex: 'subjectName',
					align: 'center',
					ellipsis: true,
					width: 150,
					render: (text: string, records: any) => (
						<span>
							{records.commoditySchemeExcelImportErrorVO
								.subjectName || '--'}
						</span>
					),
				},
				{
					title: '城市',
					dataIndex: 'cityName',
					align: 'center',
					ellipsis: true,
					width: 150,
					render: (text: string, records: any) => (
						<span>
							{records.commoditySchemeExcelImportErrorVO
								.cityName || '--'}
						</span>
					),
				},
				{
					title: '所属公司',
					dataIndex: 'affiliatedCompany',
					align: 'center',
					ellipsis: true,
					width: 150,
					render: (text: string, records: any) => (
						<span>
							{records.commoditySchemeExcelImportErrorVO
								.affiliatedCompany || '--'}
						</span>
					),
				},
				{
					title: '品牌/车系/车型',
					dataIndex: 'brandInfo',
					align: 'center',
					ellipsis: true,
					width: 150,
					render: (text: string, records: any) => (
						<span>
							{records.commoditySchemeExcelImportErrorVO
								.brandInfo || '--'}
						</span>
					),
				},
				{
					title: '星级',
					dataIndex: 'carStar',
					align: 'center',
					ellipsis: true,
					width: 150,
					render: (text: string, records: any) => (
						<span>
							{records.commoditySchemeExcelImportErrorVO
								.carStar || '--'}
						</span>
					),
				},
				{
					title: '订单类型',
					dataIndex: 'rentTypeName',
					align: 'center',
					ellipsis: true,
					width: 150,
					render: (text: string, records: any) => (
						<span>
							{records.commoditySchemeExcelImportErrorVO
								.rentTypeName || '--'}
						</span>
					),
				},
				{
					title: '租期',
					dataIndex: 'leaseTerm',
					align: 'center',
					ellipsis: true,
					width: 150,
					render: (text: string, records: any) => (
						<span>
							{records.commoditySchemeExcelImportErrorVO
								.leaseTerm || '--'}
						</span>
					),
				},
				{
					title: '定金',
					dataIndex: 'depositAmount',
					align: 'center',
					ellipsis: true,
					width: 150,
					render: (text: string, records: any) => (
						<span>
							{records.commoditySchemeExcelImportErrorVO
								.depositAmount || '--'}
						</span>
					),
				},
				{
					title: '押金',
					dataIndex: 'mortgageAmount',
					align: 'center',
					ellipsis: true,
					width: 150,
					render: (text: string, records: any) => (
						<span>
							{records.commoditySchemeExcelImportErrorVO
								.mortgageAmount || '--'}
						</span>
					),
				},
				{
					title: '月租金（新签)',
					dataIndex: 'rentAmount',
					align: 'center',
					ellipsis: true,
					width: 150,
					render: (text: string, records: any) => (
						<span>
							{records.commoditySchemeExcelImportErrorVO
								.rentAmount || '--'}
						</span>
					),
				},
				{
					title: '月租金（续签)',
					dataIndex: 'renewRentAmount',
					align: 'center',
					ellipsis: true,
					width: 150,
					render: (text: string, records: any) => (
						<span>
							{records.commoditySchemeExcelImportErrorVO
								.renewRentAmount || '--'}
						</span>
					),
				},
				{
					title: '首付款',
					dataIndex: 'advancePaymentAmount',
					align: 'center',
					ellipsis: true,
					width: 150,
					render: (text: string, records: any) => (
						<span>
							{records.commoditySchemeExcelImportErrorVO
								.advancePaymentAmount || '--'}
						</span>
					),
				},
				{
					title: '尾款',
					dataIndex: 'balancePaymentAmount',
					align: 'center',
					ellipsis: true,
					width: 150,
					render: (text: string, records: any) => (
						<span>
							{records.commoditySchemeExcelImportErrorVO
								.balancePaymentAmount || '--'}
						</span>
					),
				},
			],
		},
		{
			title: '渠道方案',
			children: [
				{
					title: '渠道SP',
					children: [
						// list1-渠道
						{
							title: 'AMC一级渠道类型',
							dataIndex: 'channelTypeOneStr1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.channelTypeOneStr1 || '--'}
								</span>
							),
						},
						{
							title: 'AMC二级渠道类型',
							dataIndex: 'channelTypeTwoStr1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.channelTypeTwoStr1 || '--'}
								</span>
							),
						},
						{
							title: '阶梯1上限数量',
							dataIndex: 'ladderNumberOne1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderNumberOne1 || '--'}
								</span>
							),
						},
						{
							title: '阶梯1奖励金额',
							dataIndex: 'ladderAmountOne1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderAmountOne1 || '--'}
								</span>
							),
						},
						{
							title: '阶梯2上限数量',
							dataIndex: 'ladderNumberTwo1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderNumberTwo1 || '--'}
								</span>
							),
						},
						{
							title: '阶梯2奖励金额',
							dataIndex: 'ladderAmountTwo1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderAmountTwo1 || '--'}
								</span>
							),
						},
						{
							title: '阶梯3上限数量',
							dataIndex: 'ladderNumberThree1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderNumberThree1 || '--'}
								</span>
							),
						},
						{
							title: '阶梯3奖励金额',
							dataIndex: 'ladderAmountThree1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderAmountThree1 || '--'}
								</span>
							),
						},
						{
							title: '阶梯4上限数量',
							dataIndex: 'ladderNumberFour1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderNumberFour1 || '--'}
								</span>
							),
						},
						{
							title: '阶梯计算方式',
							dataIndex: 'ladderNumberFour1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.stepCalculationStr1 || '--'}
								</span>
							),
						},
						{
							title: '结算时是否需要求在租',
							dataIndex: 'isRenting1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.isRenting1 || '--'}
								</span>
							),
						},
						{
							title: '稳定租赁起要求天数',
							dataIndex: 'stableLeasing1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.stableLeasing1 || '--'}
								</span>
							),
						},
						{
							title: '新司机下单前要求间隔时间',
							dataIndex: 'placeOrder1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.placeOrder1 || '--'}
								</span>
							),
						},
						{
							title: '阶梯奖励提档方式',
							dataIndex: 'proMethodStr1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.proMethodStr1 || '--'}
								</span>
							),
						},
						{
							title: '冲单奖-阶梯1下限数量',
							dataIndex: 'offsetNumberOne1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.offsetNumberOne1 || '--'}
								</span>
							),
						},
						{
							title: '冲单奖-阶梯1奖励金额',
							dataIndex: 'offsetAmountOne1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.offsetAmountOne1 || '--'}
								</span>
							),
						},
						{
							title: '冲单奖-阶梯2下限数量',
							dataIndex: 'offsetNumberTwo1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.offsetNumberTwo1 || '--'}
								</span>
							),
						},
						{
							title: '冲单奖-阶梯2奖励金额',
							dataIndex: 'offsetAmountTwo1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.offsetAmountTwo1 || '--'}
								</span>
							),
						},
						{
							title: '冲单奖-阶梯3下限数量',
							dataIndex: 'offsetNumberThree1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.offsetNumberThree1 || '--'}
								</span>
							),
						},
						{
							title: '冲单奖-阶梯3奖励金额',
							dataIndex: 'offsetAmountThree1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.offsetAmountThree1 || '--'}
								</span>
							),
						},
					],
				},
				{
					title: '自营-司推司',
					children: [
						// list2-自营-司推

						{
							title: 'AMC一级渠道类型',
							dataIndex: 'channelTypeOneStr2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.channelTypeOneStr2 || '--'}
								</span>
							),
						},
						{
							title: 'AMC二级渠道类型',
							dataIndex: 'channelTypeTwoStr2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.channelTypeTwoStr2 || '--'}
								</span>
							),
						},
						{
							title: '阶梯1上限数量',
							dataIndex: 'channelTypeTwoStr2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderNumberOne2 || '--'}
								</span>
							),
						},
						{
							title: '阶梯1奖励金额',
							dataIndex: 'ladderAmountOne2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderNumberOne2 || '--'}
								</span>
							),
						},
						{
							title: '阶梯1BD跟单费',
							dataIndex: 'ladderBdOne2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderBdOne2 || '--'}
								</span>
							),
						},
						{
							title: '阶梯2上限数量',
							dataIndex: 'ladderNumberTwo2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderNumberTwo2 || '--'}
								</span>
							),
						},
						{
							title: '阶梯2奖励金额',
							dataIndex: 'ladderAmountTwo2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderAmountTwo2 || '--'}
								</span>
							),
						},
						{
							title: '阶梯2BD跟单费',
							dataIndex: 'ladderBdTwo2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderBdTwo2 || '--'}
								</span>
							),
						},
						{
							title: '阶梯3上限数量',
							dataIndex: 'ladderNumberThree2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderNumberThree2 || '--'}
								</span>
							),
						},
						{
							title: '阶梯3奖励金额',
							dataIndex: 'ladderAmountThree2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderAmountThree2 || '--'}
								</span>
							),
						},
						{
							title: '阶梯3BD跟单费',
							dataIndex: 'ladderBdThree2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderBdThree2 || '--'}
								</span>
							),
						},
						{
							title: '阶梯4上限数量',
							dataIndex: 'ladderNumberFour2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderNumberFour2 || '--'}
								</span>
							),
						},
						{
							title: '阶梯4奖励金额',
							dataIndex: 'ladderAmountFour2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderAmountFour2 || '--'}
								</span>
							),
						},
						{
							title: '阶梯4BD跟单费',
							dataIndex: 'ladderBdFour2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderBdFour2 || '--'}
								</span>
							),
						},
						{
							title: '阶梯计算方式',
							dataIndex: 'stepCalculationStr2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.stepCalculationStr2 || '--'}
								</span>
							),
						},
						{
							title: '结算时是否需要求在租',
							dataIndex: 'isRenting2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.isRenting2 || '--'}
								</span>
							),
						},
						{
							title: '稳定租赁起要求天数',
							dataIndex: 'stableLeasing2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.stableLeasing2 || '--'}
								</span>
							),
						},
						{
							title: '新司机下单前要求间隔时间',
							dataIndex: 'placeOrder2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.placeOrder2 || '--'}
								</span>
							),
						},
						{
							title: '阶梯奖励提档方式',
							dataIndex: 'proMethodStr2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.proMethodStr2 || '--'}
								</span>
							),
						},
						{
							title: '冲单奖-阶梯1下限数量',
							dataIndex: 'offsetNumberOne2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.offsetNumberOne2 || '--'}
								</span>
							),
						},
						{
							title: '冲单奖-阶梯1奖励金额',
							dataIndex: 'offsetAmountOne2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.offsetAmountOne2 || '--'}
								</span>
							),
						},
						{
							title: '冲单奖-阶梯2下限数量',
							dataIndex: 'offsetNumberTwo2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.offsetNumberTwo2 || '--'}
								</span>
							),
						},
						{
							title: '冲单奖-阶梯2奖励金额',
							dataIndex: 'offsetAmountTwo2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.offsetAmountTwo2 || '--'}
								</span>
							),
						},
						{
							title: '冲单奖-阶梯3下限数量',
							dataIndex: 'offsetNumberThree2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.offsetNumberThree2 || '--'}
								</span>
							),
						},
						{
							title: '冲单奖-阶梯3奖励金额',
							dataIndex: 'offsetAmountThree2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.offsetAmountThree2 || '--'}
								</span>
							),
						},
					],
				},
				{
					title: '自营-普推司',
					children: [
						// list3-自营-普推
						{
							title: 'AMC一级渠道类型',
							dataIndex: 'channelTypeOneStr3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.channelTypeOneStr3 || '--'}
								</span>
							),
						},
						{
							title: 'AMC二级渠道类型',
							dataIndex: 'channelTypeTwoStr3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.channelTypeTwoStr3 || '--'}
								</span>
							),
						},
						{
							title: '阶梯1上限数量',
							dataIndex: 'ladderNumberOne3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderNumberOne3 || '--'}
								</span>
							),
						},
						{
							title: '阶梯1奖励金额',
							dataIndex: 'ladderAmountOne3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderAmountOne3 || '--'}
								</span>
							),
						},
						{
							title: '阶梯1BD跟单费',
							dataIndex: 'ladderBdOne3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderBdOne3 || '--'}
								</span>
							),
						},
						{
							title: '阶梯2上限数量',
							dataIndex: 'ladderNumberTwo3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderNumberTwo3 || '--'}
								</span>
							),
						},
						{
							title: '阶梯2奖励金额',
							dataIndex: 'ladderAmountTwo3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderAmountTwo3 || '--'}
								</span>
							),
						},
						{
							title: '阶梯2BD跟单费',
							dataIndex: 'ladderBdTwo3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderBdTwo3 || '--'}
								</span>
							),
						},
						{
							title: '阶梯3上限数量',
							dataIndex: 'ladderNumberThree3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderNumberThree3 || '--'}
								</span>
							),
						},
						{
							title: '阶梯3奖励金额',
							dataIndex: 'ladderAmountThree3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderAmountThree3 || '--'}
								</span>
							),
						},
						{
							title: '阶梯3BD跟单费',
							dataIndex: 'ladderBdThree3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderBdThree3 || '--'}
								</span>
							),
						},
						{
							title: '阶梯4上限数量',
							dataIndex: 'ladderNumberFour3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderNumberFour3 || '--'}
								</span>
							),
						},
						{
							title: '阶梯4奖励金额',
							dataIndex: 'ladderAmountFour3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderAmountFour3 || '--'}
								</span>
							),
						},
						{
							title: '阶梯4BD跟单费',
							dataIndex: 'ladderBdFour3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderBdFour3 || '--'}
								</span>
							),
						},
						{
							title: '阶梯计算方式',
							dataIndex: 'stepCalculationStr3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.stepCalculationStr3 || '--'}
								</span>
							),
						},
						{
							title: '结算时是否需要求在租',
							dataIndex: 'isRenting3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.isRenting3 || '--'}
								</span>
							),
						},
						{
							title: '稳定租赁起要求天数',
							dataIndex: 'stableLeasing3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.stableLeasing3 || '--'}
								</span>
							),
						},
						{
							title: '新司机下单前要求间隔时间',
							dataIndex: 'placeOrder3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.placeOrder3 || '--'}
								</span>
							),
						},
						{
							title: '阶梯奖励提档方式',
							dataIndex: 'proMethodStr3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.proMethodStr3 || '--'}
								</span>
							),
						},
						{
							title: '冲单奖-阶梯1下限数量',
							dataIndex: 'offsetNumberOne3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.offsetNumberOne3 || '--'}
								</span>
							),
						},
						{
							title: '冲单奖-阶梯1奖励金额',
							dataIndex: 'offsetAmountOne3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.offsetAmountOne3 || '--'}
								</span>
							),
						},
						{
							title: '冲单奖-阶梯2下限数量',
							dataIndex: 'offsetNumberTwo3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.offsetNumberTwo3 || '--'}
								</span>
							),
						},
						{
							title: '冲单奖-阶梯2奖励金额',
							dataIndex: 'offsetAmountTwo3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.offsetAmountTwo3 || '--'}
								</span>
							),
						},
						{
							title: '冲单奖-阶梯3下限数量',
							dataIndex: 'offsetNumberThree3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.offsetNumberThree3 || '--'}
								</span>
							),
						},
						{
							title: '冲单奖-阶梯3奖励金额',
							dataIndex: 'offsetAmountThree3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.offsetAmountThree3 || '--'}
								</span>
							),
						},
					],
				},
				{
					title: '自营-BD',
					children: [
						// list4-自营
						{
							title: 'AMC一级渠道类型',
							dataIndex: 'channelTypeOneStr4',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.channelTypeOneStr4 || '--'}
								</span>
							),
						},
						{
							title: 'AMC二级渠道类型',
							dataIndex: 'channelTypeTwoStr4',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.channelTypeTwoStr4 || '--'}
								</span>
							),
						},
						{
							title: '阶梯1上限数量',
							dataIndex: 'ladderNumberOne4',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderNumberOne4 || '--'}
								</span>
							),
						},
						{
							title: '阶梯1奖励金额',
							dataIndex: 'ladderAmountOne4',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderAmountOne4 || '--'}
								</span>
							),
						},
						{
							title: '阶梯2上限数量',
							dataIndex: 'ladderNumberTwo4',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderNumberTwo4 || '--'}
								</span>
							),
						},
						{
							title: '阶梯2奖励金额',
							dataIndex: 'ladderAmountTwo4',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderAmountTwo4 || '--'}
								</span>
							),
						},
						{
							title: '阶梯3上限数量',
							dataIndex: 'ladderNumberThree4',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderNumberThree4 || '--'}
								</span>
							),
						},
						{
							title: '阶梯3奖励金额',
							dataIndex: 'ladderAmountThree4',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderAmountThree4 || '--'}
								</span>
							),
						},
						{
							title: '阶梯4上限数量',
							dataIndex: 'ladderNumberFour4',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderNumberFour4 || '--'}
								</span>
							),
						},
						{
							title: '阶梯4奖励金额',
							dataIndex: 'ladderAmountFour4',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderAmountFour4 || '--'}
								</span>
							),
						},
						{
							title: '阶梯计算方式',
							dataIndex: 'stepCalculationStr4',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.stepCalculationStr4 || '--'}
								</span>
							),
						},
						{
							title: '结算时是否需要求在租',
							dataIndex: 'isRenting4',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.isRenting4 || '--'}
								</span>
							),
						},
						{
							title: '稳定租赁起要求天数',
							dataIndex: 'stableLeasing4',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.stableLeasing4 || '--'}
								</span>
							),
						},
						{
							title: '新司机下单前要求间隔时间',
							dataIndex: 'placeOrder4',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.placeOrder4 || '--'}
								</span>
							),
						},
						{
							title: '阶梯奖励提档方式',
							dataIndex: 'proMethodStr4',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.proMethodStr4 || '--'}
								</span>
							),
						},
						{
							title: '冲单奖-阶梯1下限数量',
							dataIndex: 'offsetNumberOne4',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.offsetNumberOne4 || '--'}
								</span>
							),
						},
						{
							title: '冲单奖-阶梯1奖励金额',
							dataIndex: 'offsetAmountOne4',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.offsetAmountOne4 || '--'}
								</span>
							),
						},
						{
							title: '冲单奖-阶梯2下限数量',
							dataIndex: 'offsetNumberTwo4',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.offsetNumberTwo4 || '--'}
								</span>
							),
						},
						{
							title: '冲单奖-阶梯2奖励金额',
							dataIndex: 'offsetAmountTwo4',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.offsetAmountTwo4 || '--'}
								</span>
							),
						},
						{
							title: '冲单奖-阶梯3下限数量',
							dataIndex: 'offsetNumberThree4',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.offsetNumberThree4 || '--'}
								</span>
							),
						},
						{
							title: '冲单奖-阶梯3奖励金额',
							dataIndex: 'offsetAmountThree4',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.offsetAmountThree4 || '--'}
								</span>
							),
						},
					],
				},
				{
					title: '车司',
					children: [
						// list5-车司
						{
							title: 'AMC一级渠道类型',
							dataIndex: 'channelTypeOneStr5',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.channelTypeOneStr5 || '--'}
								</span>
							),
						},
						{
							title: 'AMC二级渠道类型',
							dataIndex: 'channelTypeTwoStr5',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.channelTypeTwoStr5 || '--'}
								</span>
							),
						},
						{
							title: '阶梯1上限数量',
							dataIndex: 'ladderNumberOne5',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderNumberOne5 || '--'}
								</span>
							),
						},
						{
							title: '阶梯1奖励金额',
							dataIndex: 'ladderAmountOne5',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderAmountOne5 || '--'}
								</span>
							),
						},
						{
							title: '阶梯2上限数量',
							dataIndex: 'ladderNumberTwo5',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderNumberTwo5 || '--'}
								</span>
							),
						},
						{
							title: '阶梯2奖励金额',
							dataIndex: 'ladderAmountTwo5',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderAmountTwo5 || '--'}
								</span>
							),
						},
						{
							title: '阶梯3上限数量',
							dataIndex: 'ladderNumberThree5',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderNumberThree5 || '--'}
								</span>
							),
						},
						{
							title: '阶梯3奖励金额',
							dataIndex: 'ladderAmountThree5',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderAmountThree5 || '--'}
								</span>
							),
						},
						{
							title: '阶梯4上限数量',
							dataIndex: 'ladderNumberFour5',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderNumberFour5 || '--'}
								</span>
							),
						},
						{
							title: '阶梯4奖励金额',
							dataIndex: 'ladderAmountFour5',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.ladderAmountFour5 || '--'}
								</span>
							),
						},
						{
							title: '阶梯计算方式',
							dataIndex: 'stepCalculationStr5',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.stepCalculationStr5 || '--'}
								</span>
							),
						},
						{
							title: '结算时是否需要求在租',
							dataIndex: 'isRenting5',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.isRenting5 || '--'}
								</span>
							),
						},
						{
							title: '稳定租赁起要求天数',
							dataIndex: 'stableLeasing5',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.stableLeasing5 || '--'}
								</span>
							),
						},
						{
							title: '新司机下单前要求间隔时间',
							dataIndex: 'placeOrder5',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.placeOrder5 || '--'}
								</span>
							),
						},
						{
							title: '阶梯奖励提档方式',
							dataIndex: 'proMethodStr5',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.proMethodStr5 || '--'}
								</span>
							),
						},
						{
							title: '冲单奖-阶梯1下限数量',
							dataIndex: 'offsetNumberOne5',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.offsetNumberOne5 || '--'}
								</span>
							),
						},
						{
							title: '冲单奖-阶梯1奖励金额',
							dataIndex: 'offsetAmountOne5',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.offsetAmountOne5 || '--'}
								</span>
							),
						},
						{
							title: '冲单奖-阶梯2下限数量',
							dataIndex: 'offsetNumberTwo5',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.offsetNumberTwo5 || '--'}
								</span>
							),
						},
						{
							title: '冲单奖-阶梯2奖励金额',
							dataIndex: 'offsetAmountTwo5',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.offsetAmountTwo5 || '--'}
								</span>
							),
						},
						{
							title: '冲单奖-阶梯3下限数量',
							dataIndex: 'offsetNumberThree5',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.offsetNumberThree5 || '--'}
								</span>
							),
						},
						{
							title: '冲单奖-阶梯3奖励金额',
							dataIndex: 'offsetAmountThree5',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.offsetAmountThree5 || '--'}
								</span>
							),
						},
					],
				},
			],
		},
		{
			title: '司机奖励',
			children: [
				{
					title: '新签',
					children: [
						{
							title: '活动类型',
							dataIndex: 'activitiesType1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.activitiesType1 || '--'}
								</span>
							),
						},
						{
							title: '实物类型',
							dataIndex: 'entityType1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.entityType1 || '--'}
								</span>
							),
						},
						{
							title: '实物名称',
							dataIndex: 'issueKind1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.issueKind1 || '--'}
								</span>
							),
						},
						{
							title: '发放时间',
							dataIndex: 'releaseTime1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.releaseTime1 || '--'}
								</span>
							),
						},
						{
							title: '发放指定期数',
							dataIndex: 'numberPeriods1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.numberPeriods1 || '--'}
								</span>
							),
						},
						{
							title: '天数',
							dataIndex: 'extendedRentalDays1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.extendedRentalDays1 || '--'}
								</span>
							),
						},
						{
							title: '金额',
							dataIndex: 'amount1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.amount1 || '--'}
								</span>
							),
						},
						{
							title: '违反规定是否追回',
							dataIndex: 'isRecover1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.isRecover1 || '--'}
								</span>
							),
						},
						{
							title: '考核区间选择',
							dataIndex: 'examinationInterval1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.examinationInterval1 || '--'}
								</span>
							),
						},
						{
							title: '提车后X天获得人证',
							dataIndex: 'conformance1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.conformance1 || '--'}
								</span>
							),
						},
						{
							title: '无欠租',
							dataIndex: 'securityOne1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.securityOne1 || '--'}
								</span>
							),
						},
						{
							title: '无违章',
							dataIndex: 'securityTwo1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.securityTwo1 || '--'}
								</span>
							),
						},
						{
							title: '无出险',
							dataIndex: 'securityThree1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.securityThree1 || '--'}
								</span>
							),
						},
						{
							title: '在指定日期前完成车检',
							dataIndex: 'transportCapacity1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.transportCapacity1 || '--'}
								</span>
							),
						},
						{
							title: '日均TSH',
							dataIndex: 'dailyAverageTsh1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.dailyAverageTsh1 || '--'}
								</span>
							),
						},
						{
							title: '日均高峰TSH',
							dataIndex: 'dailyPeakTsh1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.dailyPeakTsh1 || '--'}
								</span>
							),
						},
						{
							title: '月高峰TSH',
							dataIndex: 'monthlyPeakTsh1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.monthlyPeakTsh1 || '--'}
								</span>
							),
						},
						{
							title: '日均完单量',
							dataIndex: 'dailyCompleteQuantity1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.dailyCompleteQuantity1 || '--'}
								</span>
							),
						},
						{
							title: '日均完单量',
							dataIndex: 'dailyCompleteQuantity1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.dailyCompleteQuantity1 || '--'}
								</span>
							),
						},
						{
							title: '月完单量',
							dataIndex: 'monthlyCompleteQuantity1',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.monthlyCompleteQuantity1 || '--'}
								</span>
							),
						},
					],
				},
				{
					title: '续签',
					children: [
						{
							title: '活动类型',
							dataIndex: 'activitiesType2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.activitiesType2 || '--'}
								</span>
							),
						},
						{
							title: '实物类型',
							dataIndex: 'entityType2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.entityType2 || '--'}
								</span>
							),
						},
						{
							title: '实物名称',
							dataIndex: 'issueKind2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.issueKind2 || '--'}
								</span>
							),
						},
						{
							title: '发放时间',
							dataIndex: 'releaseTime2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.releaseTime2 || '--'}
								</span>
							),
						},
						{
							title: '发放指定期数',
							dataIndex: 'numberPeriods2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.numberPeriods2 || '--'}
								</span>
							),
						},
						{
							title: '天数',
							dataIndex: 'extendedRentalDays2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.extendedRentalDays2 || '--'}
								</span>
							),
						},
						{
							title: '金额',
							dataIndex: 'amount2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.amount2 || '--'}
								</span>
							),
						},
						{
							title: '违反规定是否追回',
							dataIndex: 'isRecover2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.isRecover2 || '--'}
								</span>
							),
						},
						{
							title: '考核区间选择',
							dataIndex: 'examinationInterval2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.examinationInterval2 || '--'}
								</span>
							),
						},
						{
							title: '提车后X天获得人证',
							dataIndex: 'conformance2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.conformance2 || '--'}
								</span>
							),
						},
						{
							title: '无欠租',
							dataIndex: 'securityOne2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.securityOne2 || '--'}
								</span>
							),
						},
						{
							title: '无违章',
							dataIndex: 'securityTwo2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.securityTwo2 || '--'}
								</span>
							),
						},
						{
							title: '无出险',
							dataIndex: 'securityThree2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.securityThree2 || '--'}
								</span>
							),
						},
						{
							title: '在指定日期前完成车检',
							dataIndex: 'transportCapacity2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.transportCapacity2 || '--'}
								</span>
							),
						},
						{
							title: '日均TSH',
							dataIndex: 'dailyAverageTsh2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.dailyAverageTsh2 || '--'}
								</span>
							),
						},
						{
							title: '月TSH',
							dataIndex: 'monthTsh2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.monthTsh2 || '--'}
								</span>
							),
						},
						{
							title: '日均高峰TSH',
							dataIndex: 'dailyPeakTsh2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.dailyPeakTsh2 || '--'}
								</span>
							),
						},
						{
							title: '月高峰TSH',
							dataIndex: 'monthlyPeakTsh2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.monthlyPeakTsh2 || '--'}
								</span>
							),
						},
						{
							title: '日均完单量',
							dataIndex: 'dailyCompleteQuantity2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.dailyCompleteQuantity2 || '--'}
								</span>
							),
						},
						{
							title: '月完单量',
							dataIndex: 'monthlyCompleteQuantity2',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.monthlyCompleteQuantity2 || '--'}
								</span>
							),
						},
					],
				},
				{
					title: '提前续',
					children: [
						{
							title: '活动类型',
							dataIndex: 'activitiesType3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.activitiesType3 || '--'}
								</span>
							),
						},
						{
							title: '实物类型',
							dataIndex: 'entityType3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.entityType3 || '--'}
								</span>
							),
						},
						{
							title: '实物名称',
							dataIndex: 'issueKind3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.issueKind3 || '--'}
								</span>
							),
						},
						{
							title: '发放时间',
							dataIndex: 'releaseTime3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.releaseTime3 || '--'}
								</span>
							),
						},
						{
							title: '发放指定期数',
							dataIndex: 'numberPeriods3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.numberPeriods3 || '--'}
								</span>
							),
						},
						{
							title: '天数',
							dataIndex: 'extendedRentalDays3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.extendedRentalDays3 || '--'}
								</span>
							),
						},
						{
							title: '金额',
							dataIndex: 'amount3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.amount3 || '--'}
								</span>
							),
						},
						{
							title: '违反规定是否追回',
							dataIndex: 'isRecover3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.isRecover3 || '--'}
								</span>
							),
						},
						{
							title: '考核区间选择',
							dataIndex: 'examinationInterval3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.examinationInterval3 || '--'}
								</span>
							),
						},
						{
							title: '提车后X天获得人证',
							dataIndex: 'conformance3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.conformance3 || '--'}
								</span>
							),
						},
						{
							title: '无欠租',
							dataIndex: 'securityOne3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.securityOne3 || '--'}
								</span>
							),
						},
						{
							title: '无违章',
							dataIndex: 'securityTwo3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.securityTwo3 || '--'}
								</span>
							),
						},
						{
							title: '无出险',
							dataIndex: 'securityThree3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.securityThree3 || '--'}
								</span>
							),
						},
						{
							title: '在指定日期前完成车检',
							dataIndex: 'transportCapacity3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.transportCapacity3 || '--'}
								</span>
							),
						},
						{
							title: '日均TSH',
							dataIndex: 'dailyAverageTsh3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.dailyAverageTsh3 || '--'}
								</span>
							),
						},
						{
							title: '月TSH',
							dataIndex: 'monthTsh3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.monthTsh3 || '--'}
								</span>
							),
						},
						{
							title: '日均高峰TSH',
							dataIndex: 'dailyPeakTsh3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.dailyPeakTsh3 || '--'}
								</span>
							),
						},
						{
							title: '月高峰TSH',
							dataIndex: 'monthlyPeakTsh3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.monthlyPeakTsh3 || '--'}
								</span>
							),
						},
						{
							title: '日均完单量',
							dataIndex: 'dailyCompleteQuantity3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.dailyCompleteQuantity3 || '--'}
								</span>
							),
						},
						{
							title: '月完单量',
							dataIndex: 'monthlyCompleteQuantity3',
							align: 'center',
							ellipsis: true,
							width: 150,
							render: (text: string, records: any) => (
								<span>
									{records.commoditySchemeExcelImportErrorVO
										.monthlyCompleteQuantity3 || '--'}
								</span>
							),
						},
					],
				},
			],
		},
		{
			title: '错误信息',
			dataIndex: 'errorMessage',
			align: 'center',
			width: 200,
			ellipsis: true,
			fixed: 'right',
			render: (text: string) => {
				const obj: any = JSON.parse(text)
				const t = obj.map((item: any) => item)
				const dom = obj.map((item: any) => <span>{item || '--'}</span>)
				return <div title={t}>{dom}</div>
			},
		},
	]
	const disableStatus = (id: any, disableStatusFlg: any) => {
		updateDisableStatus({
			id,
			disableStautus: disableStatusFlg === 1 ? 1 : 2,
		})
			.then((res: any) => {
				if (res?.success) {
					message.success(res?.msg)
					onListFun()
				}
			})
			.catch((error: any) => {
				message.error(error)
			})
	}
	const columns: any = [
		{
			title: '序号',
			dataIndex: 'order',
			align: 'center',
			width: 70,
			render(text: any, record: any, index: any) {
				return <span>{(params.current - 1) * 10 + index + 1}</span>
			},
		},
		{
			title: '商品方案ID',
			dataIndex: 'commodityNo',
			align: 'center',
			width: 250,
			ellipsis: true,
			render: (text: any) => <span>{text || '--'}</span>,
		},
		{
			title: '商品方案名称',
			dataIndex: 'commodityName',
			align: 'center',
			width: 200,
			ellipsis: true,
			render: (text: any) => <span>{text || '--'}</span>,
		},
		{
			title: '订单类型',
			dataIndex: 'rentTypeName',
			align: 'center',
			width: 150,
			ellipsis: true,
			render: (text: any) => <Tag color="processing">{text || '--'}</Tag>,
		},
		{
			title: '审核状态',
			dataIndex: 'auditStatus',
			align: 'center',
			width: 150,
			ellipsis: true,
			render: (text: any) => <Tag color="processing">{text || '--'}</Tag>,
		},
		{
			title: '方案状态',
			dataIndex: 'schemeStatus',
			align: 'center',
			width: 150,
			ellipsis: true,
			render: (text: any) => (
				<>
					<Tag color="processing">{text || '--'}</Tag>
				</>
			),
		},
		{
			title: '关联司机数据',
			dataIndex: 'commodityName',
			align: 'center',
			width: 150,
			ellipsis: true,
			render: (text: any, record: any) => (
				<Button
					type="link"
					ghost
					size="small"
					onClick={() => {
						setSelectRow(record)
						setIsDriverOpen(true)
					}}>
					查看
				</Button>
			),
		},
		{
			title: '关联渠道数据',
			dataIndex: 'commodityName',
			align: 'center',
			width: 150,
			ellipsis: true,
			render: (text: any, record: any) => (
				<Button
					type="link"
					ghost
					size="small"
					onClick={() => {
						setSelectRow(record)
						setIsChannelOpen(true)
					}}>
					查看
				</Button>
			),
		},
		{
			title: '开始时间',
			dataIndex: 'beginTime',
			align: 'center',
			width: 150,
			ellipsis: true,
			render: (text: any) => <span>{text || '--'}</span>,
		},
		{
			title: '结束时间',
			dataIndex: 'endTime',
			width: 150,
			align: 'center',
			ellipsis: true,
			render: (text: any) => <span>{text || '--'}</span>,
		},
		{
			title: '主体名称',
			dataIndex: 'subjectName',
			align: 'center',
			width: 250,
			ellipsis: true,
			render: (text: any) => <span>{text || '--'}</span>,
		},
		{
			title: '所属公司',
			dataIndex: 'affiliatedCompany',
			align: 'center',
			width: 250,
			ellipsis: true,
			render: (text: any) => <span>{text || '--'}</span>,
		},
		{
			title: '城市名称',
			dataIndex: 'cityName',
			align: 'center',
			width: 150,
			ellipsis: true,
			render: (text: any) => <span>{text || '--'}</span>,
		},
		{
			title: '品牌/车系/车型',
			dataIndex: 'brandInfo',
			align: 'center',
			width: 250,
			ellipsis: true,
			render: (text: any) => <span>{text || '--'}</span>,
		},
		{
			title: '星级',
			dataIndex: 'carStar',
			align: 'center',
			width: 150,
			ellipsis: true,
			render: (text: any) => <span>{text || '--'}</span>,
		},

		{
			title: '定金（元）',
			dataIndex: 'depositAmount',
			align: 'center',
			width: 150,
			ellipsis: true,
			render: (text: any) => <span>{text || '--'}</span>,
		},
		{
			title: '押金（元）',
			dataIndex: 'mortgageAmount',
			align: 'center',
			width: 150,
			ellipsis: true,
			render: (text: any) => <span>{text || '--'}</span>,
		},
		{
			title: '租期',
			dataIndex: 'leaseTerm',
			align: 'center',
			width: 150,
			ellipsis: true,
			render: (text: any) => <span>{text || '--'}</span>,
		},
		{
			title: '月租金（新签）（元）',
			dataIndex: 'rentAmount',
			align: 'center',
			width: 180,
			ellipsis: true,
			render: (text: any) => <>{text > -1 ? text : '--'}</>,
		},
		{
			title: '月租金（续签）（元）',
			dataIndex: 'renewRentAmount',
			align: 'center',
			width: 180,
			ellipsis: true,
			render: (text: any) => <>{text > -1 ? text : '--'}</>,
		},
		{
			title: '首付款（元）',
			dataIndex: 'advancePaymentAmount',
			align: 'center',
			width: 150,
			ellipsis: true,
			render: (text: any) => <>{text > -1 ? text : '--'}</>,
		},
		{
			title: '尾款（元）',
			dataIndex: 'balancePaymentAmount',
			align: 'center',
			width: 150,
			ellipsis: true,
			render: (text: any) => <>{text > -1 ? text : '--'}</>,
		},
		{
			title: '操作',
			key: 'action',
			align: 'center',
			fixed: 'right',
			width: 300,
			render: (text: any, record: any) => {
				const i = disableStatusList.filter(
					(item: any) =>
						item.key === Number(record?.disableStatusFlg),
				)[0]
				return (
					<div>
						<Permissions permissionID="amc_merchantCenter_commodityPlan_view">
							<Button
								type="link"
								size="small"
								onClick={() => {
									history.push({
										pathname:
											'/merchantCenter/commodityPlan/view',
										query: {
											id: record.id,
											orgId: record.orgId,
											processId: record.processId,
										},
									})
								}}>
								详情
							</Button>
						</Permissions>
						{Number(record?.createUser) === Number(userId) &&
						(record?.auditStatusId === '0' ||
							record?.auditStatusId === '2') ? (
							<>
								<Permissions permissionID="amc_merchantCenter_commodityPlan_edit">
									<Button
										type="link"
										size="small"
										onClick={() => {
											dispatch({
												type: 'commodityPlan/updateState',
												payload: {
													detail: '',
												},
											})
											history.push({
												pathname:
													'/merchantCenter/commodityPlan/edit',
												query: {
													id: record.id,
												},
											})
										}}>
										编辑
									</Button>
								</Permissions>
								<Permissions permissionID="amc_merchantCenter_commodityPlan_delete">
									<Popconfirm
										placement="topLeft"
										title="你确定要删除这条数据吗？"
										onConfirm={() => onRemoveFun(record.id)}
										okText="确定"
										cancelText="取消">
										<Button type="link" size="small">
											删除
										</Button>
									</Popconfirm>
								</Permissions>
							</>
						) : null}
						{record?.approvalFlg === 1 ? (
							<Permissions permissionID="amc_merchantCenter_commodityPlan_process">
								<Button
									type="link"
									size="small"
									onClick={() => {
										history.push({
											pathname:
												'/merchantCenter/commodityPlan/process',
											query: {
												id: record?.id,
												orgId: record.orgId,
												processId: record?.processId,
											},
										})
									}}>
									审核
								</Button>
							</Permissions>
						) : null}
						<Permissions permissionID="amc_merchantCenter_commodityPlan_copy">
							<Button
								type="link"
								size="small"
								onClick={() => {
									history.push({
										pathname:
											'/merchantCenter/commodityPlan/copy',
										query: {
											id: record?.id,
											commodityNo: record?.commodityNo,
										},
									})
								}}>
								复制
							</Button>
						</Permissions>
						{record?.disableStatusFlg !== 0 ? (
							<Permissions permissionID="amc_merchantCenter_commodityPlan_enable">
								<Popconfirm
									placement="topLeft"
									title="你确定要改变这条数据状态？"
									onConfirm={() =>
										disableStatus(
											record?.id,
											record?.disableStatusFlg,
										)
									}
									okText="确定"
									cancelText="取消">
									<Button type="link" size="small">
										{i?.label}
									</Button>
								</Popconfirm>
							</Permissions>
						) : null}
					</div>
				)
			},
		},
	]

	// 初始化分页
	useEffect(() => {
		const param = {
			current: 1,
			size: params.size,
		}
		setParams(() => param)
	}, [searchData])

	// 搜索
	const onFinish = (values: {city: any; endTime: any; beginTime: any}) => {
		const beginTime = formatDate(values?.beginTime, 'YYYY-MM-DD')
		const endTime = formatDate(values?.endTime, 'YYYY-MM-DD')
		const cityId = values?.city ? values?.city[1] : ''
		const search = {
			...values,
			beginTime,
			endTime,
			cityId,
		}
		setSearchData(search)
	}

	// 搜索重置
	const onReset = () => {
		setSearchData({})
	}
	useEffect(() => {
		const formItems: any[] = [
			{
				type: 'group',
				key: 'group1',
				groupItems: [
					{
						type: 'select',
						key: 'subjectId',
						name: 'subjectId',
						label: '主体名称',
						keys: 'id',
						title: 'name',
						items: [...mainCompany],
					},
					{
						type: 'cascader',
						label: '城市名称',
						name: 'city',
						key: 'city',
						fieldNames: {
							label: 'name',
							value: 'id',
							children: 'cityInfoList',
						},
						items: [...citysList],
					},
					{
						type: 'treeSelect',
						label: '所属公司',
						name: 'affiliatedCompanyId',
						key: 'affiliatedCompanyId',
						keys: 'id',
						title: 'name',
						treeData: [...orgSource],
					},
				],
			},
			{
				type: 'group',
				key: 'group2',
				groupItems: [
					{
						type: 'select',
						key: 'rentTypeId',
						name: 'rentTypeId',
						label: '订单类型',
						keys: 'code',
						title: 'name',
						items: [...orderType],
					},
					{
						type: 'input',
						label: '商品方案ID',
						name: 'commodityNo',
						key: 'commodityNo',
					},
					{
						type: 'select',
						key: 'auditStatusId',
						name: 'auditStatusId',
						label: '审核状态',
						keys: 'code',
						title: 'name',
						items: [...approvalStatus],
					},
				],
			},
			{
				type: 'group',
				key: 'group3',
				groupItems: [
					{
						type: 'time',
						key: 'beginTime',
						name: 'beginTime',
						subtype: 'date',
						label: '开始时间',
					},
					{
						type: 'time',
						key: 'endTime',
						name: 'endTime',
						subtype: 'date',
						label: '结束时间',
					},
					{
						type: 'input',
						name: 'commodityName',
						key: 'commodityName',
						label: '商品方案名称',
					},
				],
			},
			{
				type: 'group',
				key: 'group4',
				groupItems: [
					{
						type: 'select',
						key: 'schemeStatusId',
						name: 'schemeStatusId',
						label: '方案状态',
						keys: 'code',
						title: 'name',
						items: [...schemeStatus],
					},
					{
						type: 'select',
						key: 'brandId',
						name: 'brandId',
						label: '品牌车系车型',
						keys: 'id',
						title: 'fullName',
						items: [...carTypeList],
					},
					{},
				],
			},
		]
		setFormData(formItems)
	}, [
		citysList,
		orgSource,
		orderType,
		approvalStatus,
		mainCompany,
		schemeStatus,
	])

	const onCancelToExamineView = () => {
		toExamineForm.resetFields()
		setIsToExamineView(() => false)
	}
	// 批量（含单个）审核商品方案
	const onBatchApproval = async () => {
		const toExamineFormData = await toExamineForm.validateFields()
		const body = checkData?.map((item: any) => ({
			id: item?.id,
			processId: item?.processId,
			reviewerId: userId,
			...toExamineFormData,
		}))
		batchApproval(body)
			.then((res: any) => {
				if (res?.success) {
					message.success(res?.msg)
					const param = {
						current: 1,
						size: params.size,
					}
					setParams(() => param)
					setCheckData(() => [])
					onCancelToExamineView()
					onListFun()
					checkData?.forEach((item: {id: any; processId: any}) => {
						processRecordSave({
							bizType: 10,
							bizNo: item?.id,
							processId: item.processId,
						})
					})
				}
			})
			.catch((err: any) => {
				message.error(err)
			})
	}
	// 获取导入失败表格数据
	const onTableList = (data: any) =>
		getCommodityimporterror({...data}).then((res: any) => {
			if (res?.success) {
				return res
			}
			return {}
		})

	const importData = () => {
		requisitionImport()
			.then((res: any) => {
				if (res?.success) {
					message.success(res.msg)
					setIsUploadModalOpen(() => false)
					onListFun()
				} else {
					setIsUploadModalOpen(() => false)
				}
			})
			.catch((error: any) => {
				message.error(error)
			})
	}

	return (
		<div className={styles.page}>
			<div className="search">
				{formData && (
					<SearchForm
						onFinish={onFinish}
						onReset={onReset}
						formItems={formData}
						formLayout={formItemLayout}
					/>
				)}
			</div>
			<div className="btnlist">
				<Space size={12}>
					<Permissions permissionID="amc_merchantCenter_commodityPlan_add">
						<Button
							icon={<PlusOutlined />}
							ghost
							size="small"
							type="primary"
							onClick={() => {
								dispatch({
									type: 'commodityPlan/updateState',
									payload: {
										detail: '',
									},
								})
								history.push(
									'/merchantCenter/commodityPlan/add',
								)
							}}>
							新增
						</Button>
					</Permissions>
					<Permissions permissionID="amc_merchantCenter_commodityPlan_batch">
						<Button
							icon={<PlusCircleOutlined />}
							type="primary"
							ghost
							size="small"
							disabled={!checkData?.length}
							onClick={() => {
								setIsToExamineView(true)
							}}>
							批量审核
						</Button>
					</Permissions>
					<Permissions permissionID="amc_merchantCenter_commodityPlan_import">
						<Button
							icon={<ArrowUpOutlined />}
							ghost
							size="small"
							className="btn_import"
							onClick={() => setIsUploadModalOpen(true)}>
							导入
						</Button>
					</Permissions>
					<Permissions permissionID="amc_merchantCenter_commodityPlan_export">
						<Button
							icon={<ArrowDownOutlined />}
							ghost
							size="small"
							className="btn_import"
							onClick={() => {
								downloadDocumentUrl({
									resourceId: '162',
									queryDesc: '商品方案导出,resourceId:162',
									queryParam: searchData,
								})
							}}>
							导出
						</Button>
					</Permissions>
				</Space>
			</div>
			<div className="table">
				<CustomTable
					params={params}
					columns={columns}
					pagination
					total={total}
					scroll={{y: 430}}
					callback={(pagination: any) => {
						setParams(pagination)
					}}
					kid="id"
					clearSelection
					showRowSelection
					selectCallback={(keys: any, selectData: any) => {
						setCheckData(selectData)
					}}
					getCheckboxProps={{
						getCheckboxProps: (record: any) => {
							if (record?.approvalFlg !== 1) {
								return {disabled: true}
							}
							return null
						},
					}}
					loading={loading}
					dataSource={dataSourse}
				/>
			</div>
			<BatchUpload
				isModalOpen={isUploadModalOpen}
				setIsModalOpen={setIsUploadModalOpen}
				importData={importData}
				onTableList={onTableList}
				fileNmae="excel"
				uploadFileUrl={`${modalApi.marketing}/shopec-marketing/commodity-scheme/importCommoditySchemeCheck`}
				columns={errorColumns}
				sourceId={45}
				templateType="商品司机渠道合并导入模板"
			/>
			<Modal
				title="批量审核商品方案"
				open={isToExamineView}
				onCancel={onCancelToExamineView}
				width="600px"
				destroyOnClose
				footer={
					<>
						<Button
							size="small"
							type="primary"
							onClick={onBatchApproval}>
							确定
						</Button>
						<Button size="small" onClick={onCancelToExamineView}>
							取消
						</Button>
					</>
				}>
				<>
					<Form
						form={toExamineForm}
						name="basic"
						layout="horizontal"
						labelCol={{flex: '100px'}}
						labelAlign="right"
						labelWrap
						initialValues={{remember: true}}
						autoComplete="off">
						<Row gutter={12}>
							<Col sm={{span: 24}}>
								<Form.Item
									label="审核状态"
									name="pass"
									rules={[
										{
											required: true,
											message: '请选择审核状态',
										},
									]}>
									<Radio.Group>
										<Radio value={1}>审核通过</Radio>
										<Radio value={2}>审核驳回</Radio>
									</Radio.Group>
								</Form.Item>
							</Col>
							<Col sm={{span: 24}}>
								<Form.Item label="处理意见" name="message">
									<TextArea
										maxLength={200}
										placeholder="请填写处理意见，不超过200个字符"
										autoSize={{
											minRows: 3,
											maxRows: 6,
										}}
									/>
								</Form.Item>
							</Col>
							<Col sm={{span: 24}}>
								<Form.Item label="">
									<div style={{color: 'red'}}>
										（注：审核商品方案时会将关联的司机奖励和渠道奖励规则一同审批）
									</div>
								</Form.Item>
							</Col>
						</Row>
					</Form>
				</>
			</Modal>
			<Modal
				title="司机奖励关联数据"
				open={isDriverOpen}
				onCancel={() => {
					setIsDriverOpen(false)
				}}
				width="60%"
				destroyOnClose
				footer={
					<>
						<Button
							size="small"
							onClick={() => setIsDriverOpen(false)}>
							取消
						</Button>
					</>
				}>
				<>
					<DriverRelationList
						rentSchemeId={selectRow?.rentSchemeId}
					/>
				</>
			</Modal>
			<Modal
				title="渠道奖励关联数据"
				open={isChannelOpen}
				onCancel={() => {
					setIsChannelOpen(false)
				}}
				width="60%"
				destroyOnClose
				footer={
					<>
						<Button
							size="small"
							onClick={() => setIsChannelOpen(false)}>
							取消
						</Button>
					</>
				}>
				<>
					<ChannelRelationList
						rentSchemeId={selectRow?.rentSchemeId}
					/>
				</>
			</Modal>
		</div>
	)
}
export default connect(({user}: any) => ({
	user,
}))(commodityPlan)
